public class StringTest {

    //String对象作为方法形参 传递引用
    static public void test(String name) {
        name = "张三";  //此时改变引用只是改变name，不会改变实参的值
    }

    static public void main(String [] args) {
        String a;           //字符串对象声明, 不能直接使用
        String b = "hello"; //区别普通类的实例
        // String c = new String();     //构造空字符串
        char [] c = {'a', 'b', 'c', 'd'};
        String d = new String(c);       //构造abcd字符串
        // String e = new String("hello");     //构造hello字符串
        String f = new String("");

        a = new String("hello");
        f = "world";
        a += "hello";
        if (a == f) {
            System.out.printf("相等....!\n");
        }
        System.out.printf("compareTo = %d\n", a.compareTo("hello"));
        System.out.printf("ch = %d\n", f.codePointAt(0));

        test(a);

        System.out.println(a);
    }
}
